<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('设置代课老师')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-apply-add" th:object="${adjustCourse}">
        <input name="id" th:value="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">代课老师：</label>
            <div class="col-sm-8">
                <select name="substituteTeacherId" id="substituteTeacherId" class="form-control m-b" th:with="type=${@teacher.getTeacherList()}" required>
                    <option th:each="teacher : ${type}" th:text="${teacher.userName}" th:value="${teacher.userId}"></option>
                </select>
            </div>
        </div>

        <input name="id" th:field="*{id}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">申请老师：</label>
            <div class="col-sm-8">
               <input th:field="*{teacherName}" readonly class="form-control m-b">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">学科：</label>
            <div class="col-sm-8">
                <select name="subject" class="form-control m-b" th:with="type=${@dict.getType('sc_subject_type')}"  disabled th:field="*{subject}">
                    <option value="" >请选择</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">年级：</label>
            <div class="col-sm-8">
                <select class='form-control selectpicker' id='gradeId' name='gradeId' data-th-grade-id="*{gradeId}"  disabled>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">班级名称：</label>
            <div class="col-sm-8">
                <select class='form-control selectpicker' data-live-search="true" id='classId' name='classId' data-th-class-id="*{classId}"  disabled >
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">调课节次：</label>
            <div class="col-sm-8">
                <select name="courseNo" class="form-control m-b" th:with="type=${@dict.getType('sc_course_no')}" disabled >
                    <option value="" >请选择</option>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{courseNo}"></option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">调课开始：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="beginTime" class="form-control" placeholder="请输入调课开始时间" type="text"  th:value="${#dates.format(adjustCourse.beginTime, 'yyyy-MM-dd')}" required readonly>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">调课结束：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="endTime" class="form-control" placeholder="请输入调课结束时间" type="text"  th:value="${#dates.format(adjustCourse.endTime, 'yyyy-MM-dd')}" required readonly>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">调课原因：</label>
            <div class="col-sm-8">
                <textarea name="reason" class="form-control" type="text" required placeholder="请输入调课原因"  th:field="*{reason}" readonly></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:src="@{/js/common/add_grade.js}"></script>
<script type="text/javascript">
       var prefix = ctx + "school/course"
        $("#form-apply-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var teacherName = $("#substituteTeacherId").find("option:selected").text();
                var data = $.param({"substituteTeacherName":teacherName,"status":2}) + "&" + $("#form-apply-add").serialize();
                $.operate.save(prefix + "/edit", data);
            }
        }


</script>
</body>
</html>